﻿IF EXISTS (SELECT * FROM sysobjects WHERE type = 'P' AND name = 'ArticuloGetList')
	BEGIN
		DROP  Procedure  ArticuloGetList
	END
GO

CREATE PROCEDURE ArticuloGetList 	
	(	
		@empresaId AS INT,		
		@filtroNombre AS VARCHAR(100) = NULL,
		@filtroCodigo AS VARCHAR(100) = NULL
	)	
AS
BEGIN	
	SET NOCOUNT ON
	
	SELECT ArticuloId AS Id, Codigo, DescripcionCorta, 1 Precio, 1 Existencia, 1 EnTransito, 1 Comprometido, 1 Disponible
	FROM Articulo
	WHERE EmpresaId = @empresaId	  
	  AND DescripcionCorta like '%' + ISNULL(@filtroNombre,DescripcionCorta) + '%'
	  AND Codigo like '%' + ISNULL(@filtroCodigo,Codigo) + '%'

	SET NOCOUNT OFF
END
GO

  